package cn.shyouchi.wuguanjia.android.ui.event.proprietor;

import android.graphics.Color;
import android.text.InputType;

/**
 * Created by Eenie on 2016/10/19 at 11:29
 * Email: 472279981@qq.com
 * Des:
 */

public class ProprietorInfoModel {
    public static final int INFO_TYPE_AVATAR = 0;
    public static final int INFO_TYPE_NAME = 1;
    public static final int INFO_TYPE_GENDER = 2;
    public static final int INFO_TYPE_AGE = 3;
    public static final int INFO_TYPE_HEIGHT = 4;
    public static final int INFO_TYPE_DUTY = 5;
    public static final int INFO_TYPE_WORK_TIME = 6;
    public static final int INFO_TYPE_PLATE = 7;
    public static final int INFO_TYPE_OTHER = 8;
    public static final int INFO_TYPE_PHONE = 9;

    private static final int COLOR_FILLED = Color.GRAY;
    private static final int COLOR_NOT_FILL = Color.parseColor("#1786FF");
    private static final int COLOR_FILL_ERROR = Color.RED;

    public static final int EDIT_TYPE_FILL = 0;
    public static final int EDIT_TYPE_SEL = 1;
    public static final int EDIT_TYPE_JSON = 2;

    private String name;
    private String value;
    private int type;
    private boolean notNull;
    private boolean filled;
    private int txtColor = COLOR_NOT_FILL;
    private int inputType = InputType.TYPE_CLASS_TEXT;
    private String hint;
    private String[] options;


    private int editType = EDIT_TYPE_FILL;


    boolean multiLines = false;

    public String getHint() {
        return hint;
    }

    public void setHint(String hint) {
        this.hint = hint;
    }

    public int getInputType() {
        return inputType;
    }

    public void setInputType(int inputType) {
        this.inputType = inputType;
    }

    public ProprietorInfoModel(int type, String name, String hint, int editType, int inputType, boolean multiLines, boolean notNull) {
        this.type = type;
        this.name = name;
        this.hint = hint;
        this.editType = editType;
        this.inputType = inputType;
        this.notNull = notNull;
        this.multiLines = multiLines;
    }

    public ProprietorInfoModel(int type, String name, String hint, int editType, int inputType, boolean multiLines, boolean notNull, String value) {
        this.type = type;
        this.name = name;
        this.hint = hint;
        this.editType = editType;
        this.inputType = inputType;
        this.notNull = notNull;
        this.multiLines = multiLines;
        this.value = value;
        this.filled = true;
    }


    public ProprietorInfoModel(int type, String name, int editType, String[] options, boolean notNull) {
        this.type = type;
        this.name = name;
        this.editType = editType;
        this.notNull = notNull;
        this.options = options;
    }

    public ProprietorInfoModel(int type, String name, int editType, String[] options, boolean notNull, String value) {
        this.type = type;
        this.name = name;
        this.editType = editType;
        this.notNull = notNull;
        this.options = options;
        this.value = value;
        this.filled = true;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public String getHintValue() {

        switch (type) {
            case INFO_TYPE_GENDER:
                return value.equals("1") ? "男" : "女";
            case INFO_TYPE_AGE:
                return value + "岁";
            case INFO_TYPE_HEIGHT:
                return value + "cm";
            default:
                return value;
        }


    }

    public void setValue(String value) {
        this.value = value;
        txtColor = COLOR_FILLED;
        filled = true;
    }


    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public boolean isNotNull() {
        return notNull;
    }

    public void setNotNull(boolean notNull) {
        this.notNull = notNull;
    }

    public int getTxtColor() {
        return txtColor;
    }

    public void setFillError() {
        this.txtColor = COLOR_FILL_ERROR;
    }

    public boolean isFilled() {
        return filled;
    }

    public int getEditType() {
        return editType;
    }

    public void setEditType(int editType) {
        this.editType = editType;
    }

    public void setFilled(boolean filled) {
        this.filled = filled;
    }

    public boolean isMultiLines() {
        return multiLines;
    }

    public void setMultiLines(boolean multiLines) {
        this.multiLines = multiLines;
    }


    public void selValue(int which) {
        setValue(options[which]);
    }


    public String[] getOptions() {
        return options;
    }


    public void setOptions(String[] options) {
        this.options = options;
    }
}
